<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>原型继承模式</title>
</head>
<body>


<script type="text/javascript" src="object.js"></script>
<script type="text/javascript">
    var a = {
        name: "a"
    };
    var aa = object(a);
    alert(aa.name);


    // 变形：object函数可以通过传递构造函数的原型，来实现对原型的继承
    // eg:
    var A = function() {
        this.name = "a" ;
    };
    A.prototype.getName = function() {
        return this.name;
    };

    var aaa = object(A.prototype);
    alert(typeof aaa.name);
    alert(typeof aaa.getName);

    var dd = "dfdf";
    alert(dd.name);
    alert(dd instanceof String);

</script>
</body>
</html>